<!--suppress ALL -->
<template>
    <div>
        <el-row>
            <el-button type="primary" @click="trackMore">跟踪事项</el-button>
        </el-row>
        <el-row>
            <el-table :data="tableData" border ref="multipleTable" @selection-change="handleSelectionChange">
                <el-table-column type="selection" width="55" align="center"></el-table-column>
                <el-table-column prop="todoTitle" label="内容" sortable >
                </el-table-column>
                <el-table-column prop="fromUserName" label="发起人" width="120">
                </el-table-column>
                <el-table-column prop="ts" label="日期" width="170">
                </el-table-column>
            </el-table>
            <div class="pagination">
                <el-pagination background @current-change="handleCurrentChange" layout="prev, pager, next" :total="totalData">
                </el-pagination>
            </div>
        </el-row>
    </div>
</template>

<script>
let userCode = sessionStorage.getItem('ms_username');
//var userCode = '002';
import bus from '../../common/bus';
export default {
    name:'todoMore',
    data() {
        return {
            tableData: [],
            cur_page: 1,
            multipleSelection: [],
            totalData:1
        };
    },
    created() {
        this.getData();
    },
    methods: {
        // 分页导航
        handleCurrentChange(val) {
            //console.log(val);
            this.cur_page = val;
            this.getData();
        },
        getData() {
            this.$axios.get('/ptp-msg/apis/todo?pn=1&ps=30&userCode='+userCode)
                .then((res) => {
                    this.tableData = res.data.data.todoList;
                    this.totalData = parseInt(res.data.data.pageData.totalNumber);
                });
        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        trackMore(){
            bus.$emit('openMenu','trackMore','跟踪事项');
        }
    }
};
</script>
